package com.jason.enumtest;

import org.junit.Test;

/**
 * @Author: Jason
 * @Date: 16/4/7
 * @Time: 22:12
 */
public class EnumTest01 {

    @Test
    public void test1() {
        print(Grade.D);

    }

    public void print(Grade grade) {
        String value = grade.localeValue();
        System.out.println(value);

    }


}

// 带抽象方法的枚举

enum Grade {

    A("100-90") {
        @Override
        public String localeValue() {
            return "优秀";
        }
    },

    B("89-80") {
        @Override
        public String localeValue() {
            return "良好";
        }
    },

    C("79-70") {
        @Override
        public String localeValue() {
            return "一般";
        }
    },

    D("69-60") {
        @Override
        public String localeValue() {
            return "及格";
        }
    },
    E("59-0") {
        @Override
        public String localeValue() {
            return "不及格";
        }
    };


    private String value;

    private Grade(String value) {
        this.value = value;
    }

    public String getValue() {
        return this.value;
    }

    public abstract String localeValue() ;
}
